package com.duowei.diandan.bean.food;

import com.duowei.diandan.db.entry.Tcsd;

import java.util.List;

/**
 * 套餐子项组
 */

public class MealChildGroup {
    private List<String> cateList;
    private List<Tcsd> childList;

    public MealChildGroup(List<String> cateList, List<Tcsd> childList) {
        this.cateList = cateList;
        this.childList = childList;
    }

    public List<String> getCateList() {
        return cateList;
    }

    public void setCateList(List<String> cateList) {
        this.cateList = cateList;
    }

    public List<Tcsd> getChildList() {
        return childList;
    }

    public void setChildList(List<Tcsd> childList) {
        this.childList = childList;
    }

    public String getCateStr() {
        StringBuilder sb = new StringBuilder();
        for (String c : cateList) {
            if (sb.length() == 0) {
                sb.append(c);
            } else {
                sb.append("、").append(c);
            }
        }

        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof MealChildGroup) {
            MealChildGroup mcg = (MealChildGroup) obj;

            return this.cateList.containsAll(mcg.cateList)
                    && this.childList.containsAll(mcg.childList);
        } else {
            return false;
        }
    }
}
